﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace STMS.WSTMSystem.UControls
{
    public partial class UIconButton : Button
    {
        public UIconButton()
        {
            InitializeComponent();
            this.Width = 30;
            this.Height = 30;
            this.Font = new Font("Webdings", 10.8F);
            this.FlatStyle = FlatStyle.Flat;
            this.FlatAppearance.BorderSize = 0;
            this.Text = "1";
        }

        [DefaultValue(typeof(string), "1"), Description("控件文本")]
        private string  btnText = "1";
        public string BtnText
        {
            get { return btnText; }
            set
            {
                btnText = value;
                this.Text = btnText;
            }
        }

        [DefaultValue(typeof(Color), " 53, 61, 134"), Description("控件背景色")]
        private Color bgColor =Color.FromArgb(53, 61, 134);
        public Color BgColor
        {
            get { return bgColor; }
            set
            {
                bgColor = value;
                this.BackColor = bgColor;
                this.Invalidate();
            }
        }
        public event EventHandler BtnClick;
        protected override void OnClick(EventArgs e)
        {
          
            base.OnClick(e);
            BtnClick?.Invoke(this, e);
        }
        protected override void OnMouseEnter(EventArgs e)
        {
            base.OnMouseEnter(e);
            this.BgColor = Color.White;
        }
                 
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);
            this.BgColor = Color.FromArgb(53, 61, 134);
        }

        protected override bool ShowFocusCues
        {
            get
            {
                return false;
            }
        }

    }
}
